<?php
/**
 * winbinder package 
 *
 * @package php.ui.winbinder
 */

/**
 * WBDraw 클래스 
 *
 * @package php.ui.winbinder 
 */ 
class WBDraw extends PObject { 

	const LINE_SOLID			= 0;
	const LINE_DOTTED			= 1;
	const LINE_DASHES_2			= 2;
	const LINE_DASHES_3			= 3;
	const LINE_DASHES_4			= 4;
	const LINE_DASHES_5			= 5;
	const LINE_DASHES_6			= 6;
	const LINE_DASHES_7			= 7;
	const LINE_DASHES_DOTS		= 8;
	const LINE_DASHES_DOUBLE_DOTS = 9;

	const POS_LEFT		= WBC_LEFT;
	const POS_CENTER	=  WBC_CENTER;
	const POS_RIGHT		=  WBC_RIGHT;
	const POS_TOP		=  WBC_TOP;
	const POS_MIDDLE	=  WBC_MIDDLE;
	const POS_BOTTOM	=  WBC_BOTTOM;

	const MULTILINE		=  WBC_MULTILINE;
	const ELLIPSIS		=  WBC_ELLIPSIS;



	/**
	 * target에 bitmap 데이타를 그림 
	 *
	 * @param mixed $target 
	 * @param mixed $bitmap 
	 * @param int $x 
	 * @param int $y 
	 * @param int $width
	 * @param int $height 
	 * @param int $transparentcolor 투명도  
	 */
	public static function image($target, $bitmap, $x = 0, $y = 0, $width = 0, $height = 0, $transparentcolor = NOCOLOR, $offsetX = 0, $offsetY = 0 ) { 
		return wb_draw_image($target, wbinstance($bitmap), $x, $y, $width, $height, $transparentcolor, $offsetX, $offsetY);
	}

	/**
	 * target에 line을 그림 
	 *
	 *
	 */
	public static function line($target, $x0, $y0, $x1, $y1, $color = BLACK, $lineWidth = 1, $lineStyle = WBDraw::LINE_SOLID) { 
		return wb_draw_line($target, $x0, $y0, $x1, $y1, $color, $lineWidth, $lineStyle);
	}

	/**
	 *
	 * target에 rect(사각형) 을 그림 
	 *
	 */
	public static function rect($target, $x, $y, $width, $height, $color , $filled = false, $lineWidth = 1, $lineStyle = WBDraw::LINE_SOLID) { 
		return wb_draw_rect($target, $x, $y, $width, $height, $color, $filled, $lineWidth, $lineStyle);
	}

	/**
	 *
	 * target에 ellipse(타원) 을 그림 
	 *
	 */
	public static function ellipse($target, $x, $y, $width, $height, $color , $filled = false, $lineWidth = 1, $lineStyle = WBDraw::LINE_SOLID) { 
		return wb_draw_ellipse($target, $x, $y, $width, $height, $color, $filled, $lineWidth, $lineStyle);
	}

	/**
	 * 선택한 영역의 pixel의 color 값 얻어오기 
	 *
	 *
	 */
	public static function getPixel($source, $x, $y) { 
		return wb_get_pixel($source, $x, $y);
	}

	/**
	 * 선택한 영역의 pixel의 color 설정 하기 
	 *
	 *
	 */ 
	public static function setPixel($source, $x, $y, $color) { 
		return wb_draw_point($source, $x, $y, $color);
	}

	/**
	 * text를 그림 
	 *
	 * <code>
	 * //flags 관련 상수
	 *
	 * WBC_LEFT
	 * WBC_CENTER
	 * WBC_RIGHT
	 * WBC_TOP
	 * WBC_MIDDLE
	 * WBC_BOTTOM
	 * WBC_MULTILINE
	 * WBC_ELLIPSIS
	 * </code>
	 */ 
	public static function text($target, $text, $x, $y) { 
		$arr = func_get_args();
		call_user_func_array('wb_draw_text', $arr);
	}
}
?>